<?php
namespace App\Http\Middleware;

use Closure;
use Illuminate\Http\Response;
use Tymon\JWTAuth\Facades\JWTAuth;

class Admin
{
    public function handle($request, Closure $next)
    {
        $user=JWTAuth::parseToken()->authenticate();
        if($user->gid!=1)
        {
            $data=new \stdClass();
            return response()->json([
                'status'=>false,
                'code' => 400007,
                'message' => '用户无权限',
                'data'=>$data
            ], 401);
        }

        return $next($request);
    }

}